#ifndef __HERM_BASE_SOCKET_POSIX_SOCKET_DEF_H__
#define __HERM_BASE_SOCKET_POSIX_SOCKET_DEF_H__

#include <sys/socket.h>
#include <sys/types.h>
#include <string>
#include <cstring>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <fcntl.h>  // fcntl 
#include <errno.h>
#include <unistd.h>

namespace herm{

typedef long MultiplexorMask;
typedef int Handle; 
typedef socklen_t SockLen;

const Handle INVALID_HANDLE = -1;
const int COMPLETION = -1;
const int PENDING = 1;

namespace Private{
	
const int FAILED = -1; 

#ifdef __APPLE__
    const int HOP_FLAG_NOSIGNAL = 0; 
#else
    const int HOP_FLAG_NOSIGNAL = MSG_NOSIGNAL; 
#endif

//const int HEMSG_NOSIGNAL = MSG_NOSIGNAL; // HE==Herm Error
const int HEWOULDBLOCK = EWOULDBLOCK; 
const int HEINPROGRESS = EINPROGRESS; 
const int HECONNRESET = ECONNRESET;

inline int Close(herm::Handle s)
{
	return close(s);
}

inline int GetLastError()
{
	return errno;
}

inline std::string GetLastStrError(int errNo)
{
	return strerror(errNo);
}
} // namespace Private
} // end namespace Herm

#endif

